package main.Primavera;

import javax.swing.*;
import javax.swing.plaf.basic.BasicComboBoxRenderer;
import java.awt.*;

/**
 * Created by s_shmakov on 11.01.2015.
 */
public class ComboRenderer extends BasicComboBoxRenderer {

    private static final long serialVersionUID = 1L;

    @Override
    public Component getListCellRendererComponent(JList list, Object value,
                                                  int index, boolean isSelected, boolean cellHasFocus) {
        super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
        if (value != null) {
            ConfigNode item = (ConfigNode) value;
            setText(item.getConfigValue().toUpperCase());
        }
        if (index == -1) {
//            ConfigNode item = (ConfigNode) value;
//            setText("" + item.getConfigValue());
        }
        return this;
    }

}
